package com.hsnn.medstgmini.base.dict.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.hsnn.medstgmini.model.Status;
import com.hsnn.medstgmini.util.DateUtil;

@Entity
@Table(name = "dic_phar_log")
public class DicPharLog implements Serializable {

	private static final long serialVersionUID = 1L;

	private String logId;
	private String pharId;
	private String pharCode;
	private String pharName;
	private Integer status;
	private Date updDateTime;
	private String updUser;
	private Integer sortId;
	private String fatherId;

	private String statusName;
	private String fatherPharCode;
	private String fatherPharName;
	private String updDateTimeStr;
	private Date startTime;
	private Date endTime;

	public DicPharLog() {
	}

	public DicPharLog(String pharId, String pharCode, String pharName,
			Integer status, Date updDateTime, String updUser, Integer sortId,
			String fatherId, String fatherPharCode, String fatherPharName) {
		super();
		this.pharId = pharId;
		this.pharCode = pharCode;
		this.pharName = pharName;
		this.status = status;
		this.updDateTime = updDateTime;
		this.updUser = updUser;
		this.sortId = sortId;
		this.fatherId = fatherId;
		this.fatherPharCode = fatherPharCode;
		this.fatherPharName = fatherPharName;
	}

	@Id
	@Column(name = "log_id")
	public String getLogId() {
		return logId;
	}

	public void setLogId(String logId) {
		this.logId = logId;
	}

	@Column(name = "father_id")
	public String getFatherId() {
		return fatherId;
	}

	public void setFatherId(String fatherId) {
		this.fatherId = fatherId;
	}

	@Transient
	public String getFatherPharCode() {
		return fatherPharCode;
	}

	public void setFatherPharCode(String fatherPharCode) {
		this.fatherPharCode = fatherPharCode;
	}

	@Transient
	public String getFatherPharName() {
		return fatherPharName;
	}

	public void setFatherPharName(String fatherPharName) {
		this.fatherPharName = fatherPharName;
	}

	@Column(name = "phar_id")
	public String getPharId() {
		if (pharId != null) {
			pharId = pharId.trim();
		}
		return pharId;
	}

	public void setPharId(String pharId) {
		this.pharId = pharId;
	}

	@Column(name = "phar_code")
	public String getPharCode() {
		return pharCode;
	}

	public void setPharCode(String pharCode) {
		this.pharCode = pharCode;
	}

	@Column(name = "phar_name")
	public String getPharName() {
		if (pharName != null) {
			pharName = pharName.trim();
		}
		return pharName;
	}

	public void setPharName(String pharName) {
		this.pharName = pharName;
	}

	@Column(name = "status")
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@Column(name = "upd_datetime")
	public Date getUpdDateTime() {
		return updDateTime;
	}

	public void setUpdDateTime(Date updDateTime) {
		this.updDateTime = updDateTime;
	}

	@Column(name = "upd_user")
	public String getUpdUser() {
		return updUser;
	}

	public void setUpdUser(String updUser) {
		this.updUser = updUser;
	}

	@Column(name = "sort_id")
	public Integer getSortId() {
		return sortId;
	}

	public void setSortId(Integer sortId) {
		this.sortId = sortId;
	}

	@Transient
	public String getStatusName() {
		if (status != null) {
			statusName = Status.getName(status);
		}
		return statusName;
	}

	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}

	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Transient
	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Transient
	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	@Transient
	public String getUpdDateTimeStr() {
		if (updDateTime != null) {
			updDateTimeStr = DateUtil.date(updDateTime);
		}
		return updDateTimeStr;
	}

	public void setUpdDateTimeStr(String updDateTimeStr) {
		this.updDateTimeStr = updDateTimeStr;
	}

}